package com.example.sport;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity3 extends AppCompatActivity {
    int i=1;int j=1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);
        Button btn= findViewById(R.id.btn_finish);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent= new Intent(MainActivity3.this,MainActivity.class);
                startActivity(intent);
            }
        });

        Button genderButton1 =findViewById(R.id.bn1_man);
        Button genderButton2 =findViewById(R.id.bn1_women);

        genderButton1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                i++;
                if(i%2==0){
                    genderButton1.setBackground(getResources().getDrawable(R.drawable.btn_nopress_shape));
                    genderButton2.setBackground(getResources().getDrawable(R.drawable.btn_press_shape));
                }
                else{
                    genderButton2.setBackground(getResources().getDrawable(R.drawable.btn_nopress_shape));
                    genderButton1.setBackground(getResources().getDrawable(R.drawable.btn_press_shape));
                }
            }
        });
        genderButton2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                j++;
                if(j%2==0){
                    genderButton1.setBackground(getResources().getDrawable(R.drawable.btn_nopress_shape));
                    genderButton2.setBackground(getResources().getDrawable(R.drawable.btn_press_shape));
                }
                else{
                    genderButton2.setBackground(getResources().getDrawable(R.drawable.btn_nopress_shape));
                    genderButton1.setBackground(getResources().getDrawable(R.drawable.btn_press_shape));
                }
            }

        });
    }
}